/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package MyOwnChat;

/**
 *
 * @author lubinchen
 */



import java.net.*;



public class LubinNewClient implements Runnable{

    public      InetAddress      myrealip=null;
    public      int              port=4000;
    public String name;

    public LubinNewClient(String DestinationIP, int inport, String names){
        // this part is only to initialize the public variables
        try{
        myrealip= InetAddress.getByName(DestinationIP);
        name=names;

        }catch (Exception e){
            System.out.println("Exception caught at setting up client "+DestinationIP+" with problem: " +e.getMessage());}

        port=inport;
    }


    public void run(){

  
         try{

                    System.out.println("@LubinNewClient Class now");      
                    ChatClient client=new ChatClient(myrealip, port, name);
                    new Thread(client).start();
                    System.out.println("Added a new client of name: "+name);
                    //client.start();
                   
                    System.out.println("Client "+myrealip.getHostAddress()+" has started");
            }catch (Exception e){ 
            System.out.println("Exception caught at setting up client "+myrealip.getHostAddress()+" with problem: " +e.getMessage());}

            
    }

}
